
/*
 * Copyright 2002-2021 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/*
 *版权所有2002-2021原作者。
 *
 *根据Apache许可证2.0版许可（“许可证”）；
 *除非符合许可证的规定，否则您不得使用此文件。
 *您可以在以下网址获取许可证副本：
 *
 *https://www.apache.org/licenses/LICENSE-2.0
 *
 *除非适用法律要求或书面同意，软件
 *根据许可证进行的分发是在“按原样”的基础上进行的，
 *无任何明示或暗示的保证或条件。
 *有关管理权限的特定语言，请参阅许可证和
 *许可证下的限制。
 */

package org.springframework.scheduling;

/**
 * Extension of the {@link Runnable} interface, adding special callbacks
 * for long-running operations.
 *
 * <p>Scheduling-capable TaskExecutors are encouraged to check a submitted
 * Runnable, detecting whether this interface is implemented and reacting
 * as appropriately as they are able to.
 *
 * @author Juergen Hoeller
 * @since 2.0
 * @see org.springframework.core.task.TaskExecutor
 * @see SchedulingTaskExecutor
 */
/**
 *｛@link Runnable｝接口的扩展，添加特殊回调
 *用于长时间运行的操作。
 *
 *<p>鼓励具有计划功能的任务执行器检查提交的
 *可运行，检测此接口是否已实现并作出反应
 *尽可能适当。
 *
 *@作者于尔根·霍勒
 *@自2.0起
 *@参见org.springframework.core.task.TaskExecutitor
 *@参见SchedulelingTaskExecutitor
 */
public interface SchedulingAwareRunnable extends Runnable {

	/**
	 * Return whether the Runnable's operation is long-lived
	 * ({@code true}) versus short-lived ({@code false}).
	 * <p>In the former case, the task will not allocate a thread from the thread
	 * pool (if any) but rather be considered as long-running background thread.
	 * <p>This should be considered a hint. Of course TaskExecutor implementations
	 * are free to ignore this flag and the SchedulingAwareRunnable interface overall.
	 */
	/**
	 *返回Runnable的操作是否长期有效
	 *（｛@code-true｝）与短命（｛@code false｝）。
	 *<p>在前一种情况下，任务不会从线程中分配线程
	 *池（如果有的话），而是被视为长时间运行的后台线程。
	 *<p>这应该被视为一个提示。当然任务执行器实现
	 *可以完全忽略此标志和SchedulingAwareRunnable接口。
	 */
	boolean isLongLived();

}
